function runTests( name, tests )
{
	YUI().use
	(
		"console",
		function(Y)
		{
			//create the console
			var r = new Y.Console
			(
				{
					useBrowserConsole: true, // tests will be reported both in the YUI and browser native console
					newestOnTop : false,
					style: 'block' // to anchor in the example content
				}
			);

			r.render('#testLogger');

			var TestRunner = YUITest.TestRunner;
			TestRunner.setName(name);

			for( var i/*Number*/=0; i<tests.length; i++ )
				TestRunner.add(tests[i]);

			//function to handle events generated by the testrunner
			function logEvent(event)
			{
				//data variables
				var message = "";
				var messageType = "";

				switch(event.type)
				{
					case TestRunner.BEGIN_EVENT:
						message = "Testing began at " + (new Date()).toString() + ".";
						messageType = "info";
					break;

					case TestRunner.COMPLETE_EVENT:
						message = Y.substitute
						(
							"Testing completed at " +
								(new Date()).toString() + ".\n" +
								"Passed:{passed} Failed:{failed} " +
								"Total:{total} ({ignored} ignored)",
							event.results
						);
						messageType = "info";
					break;

					case TestRunner.TEST_FAIL_EVENT:
						message = event.testName + ": failed.\n" + event.error.getMessage();
						messageType = "fail";
					break;

					case TestRunner.TEST_IGNORE_EVENT:
						message = event.testName + ": ignored.";
						messageType = "ignore";
					break;

					case TestRunner.TEST_PASS_EVENT:
						message = event.testName + ": passed.";
						messageType = "pass";
					break;

					case TestRunner.TEST_SUITE_BEGIN_EVENT:
						message = "Test suite \"" + event.testSuite.name + "\" started.";
						messageType = "info";
					break;

					case TestRunner.TEST_SUITE_COMPLETE_EVENT:
						message = Y.substitute
						(
							"Test suite \"" +
								event.testSuite.name + "\" completed" + ".\n" +
								"Passed:{passed} Failed:{failed} " +
								"Total:{total} ({ignored} ignored)",
							event.results
						);
						messageType = "info";
					break;

					case TestRunner.TEST_CASE_BEGIN_EVENT:
						message = "Test case \"" + event.testCase.name + "\" started.";
						messageType = "info";
					break;

					case TestRunner.TEST_CASE_COMPLETE_EVENT:
						message = Y.substitute
						(
							"Test case \"" +
								event.testCase.name + "\" completed.\n" +
								"Passed:{passed} Failed:{failed} " +
								"Total:{total} ({ignored} ignored)",
							event.results
						);
						messageType = "info";
					break;

					default:
						message = "Unexpected event " + event.type;
						message = "info";
				}

				//only log if required
				Y.log(message, messageType, "TestRunner");
			}

			//listen for events to publish to the logger
			TestRunner.attach(TestRunner.BEGIN_EVENT, logEvent);
			TestRunner.attach(TestRunner.COMPLETE_EVENT, logEvent);
			TestRunner.attach(TestRunner.TEST_CASE_BEGIN_EVENT, logEvent);
			TestRunner.attach(TestRunner.TEST_CASE_COMPLETE_EVENT, logEvent);
			TestRunner.attach(TestRunner.TEST_SUITE_BEGIN_EVENT, logEvent);
			TestRunner.attach(TestRunner.TEST_SUITE_COMPLETE_EVENT, logEvent);
			TestRunner.attach(TestRunner.TEST_PASS_EVENT, logEvent);
			TestRunner.attach(TestRunner.TEST_FAIL_EVENT, logEvent);
			TestRunner.attach(TestRunner.TEST_IGNORE_EVENT, logEvent);

			//run the tests
			TestRunner.run();
		}
	);
}